package com.ruoyi.admin.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.admin.domain.MlPromotionDto;
import com.ruoyi.admin.mapper.MlPromotionDtoMapper;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.admin.mapper.SysUserDtoMapper;
import com.ruoyi.admin.domain.SysUserDto;
import com.ruoyi.admin.service.ISysUserDtoService;

/**
 * 用户信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class SysUserDtoServiceImpl extends ServiceImpl<SysUserDtoMapper, SysUserDto> implements ISysUserDtoService
{
    @Autowired
    private SysUserDtoMapper sysUserDtoMapper;

    //通过用户id查询所有用户信息放入到Map中返回到前端
    @Override
    public Map<String,Object> selectUsernameAndAddressByUserId(Long userId) {
        Map<String,Object> result = new HashMap<>();
        SysUserDto sysUserDto = sysUserDtoMapper.selectUsernameAndAddressByUserId(userId);
        result.put("sysUserDto",sysUserDto);
        return result;
    }

    /**
     * 查询用户信息
     * 
     * @param userId 用户信息主键
     * @return 用户信息
     */
    @Override
    public SysUserDto selectSysUserDtoByUserId(Long userId)
    {
        return sysUserDtoMapper.selectSysUserDtoByUserId(userId);
    }

    /**
     * 查询用户信息列表
     * 
     * @param sysUserDto 用户信息
     * @return 用户信息
     */
    @Override
    public List<SysUserDto> selectSysUserDtoList(SysUserDto sysUserDto)
    {
        return sysUserDtoMapper.selectSysUserDtoList(sysUserDto);
    }

    /**
     * 新增用户信息
     * 
     * @param sysUserDto 用户信息
     * @return 结果
     */
    @Override
    public int insertSysUserDto(SysUserDto sysUserDto)
    {
        sysUserDto.setCreateTime(DateUtils.getNowDate());
        return sysUserDtoMapper.insertSysUserDto(sysUserDto);
    }

    /**
     * 修改用户信息
     * 
     * @param sysUserDto 用户信息
     * @return 结果
     */
    @Override
    public int updateSysUserDto(SysUserDto sysUserDto)
    {
        sysUserDto.setUpdateTime(DateUtils.getNowDate());
        return sysUserDtoMapper.updateSysUserDto(sysUserDto);
    }

    /**
     * 批量删除用户信息
     * 
     * @param userIds 需要删除的用户信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUserDtoByUserIds(Long[] userIds)
    {
        return sysUserDtoMapper.deleteSysUserDtoByUserIds(userIds);
    }

    /**
     * 删除用户信息信息
     * 
     * @param userId 用户信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUserDtoByUserId(Long userId)
    {
        return sysUserDtoMapper.deleteSysUserDtoByUserId(userId);
    }
}
